# Contributor: Mark Pashmfouroush <mark@markpash.me>
# Maintainer: Mark Pashmfouroush <mark@markpash.me>
pkgname=coredns
pkgver=1.7.0
pkgrel=0
pkgdesc="CoreDNS is a fast and flexible DNS server"
url="https://github.com/coredns/coredns"
arch="all !mips !mips64 !x86 !armv7 !armhf"
license="Apache-2.0"
options="net"
makedepends="go"
install="$pkgname.pre-install"
subpackages="$pkgname-openrc"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/coredns/coredns/archive/v$pkgver.tar.gz
	coredns.confd
	coredns.initd
	"

build() {
	make
}

check() {
	cd "$builddir"/request; go test ./...
	cd "$builddir"/core; go test ./...
	cd "$builddir"/coremain; go test ./...
	cd "$builddir"/plugin; go test ./...
}

package() {
	install -Dm644 "$srcdir"/coredns.confd "$pkgdir"/etc/conf.d/coredns
	install -Dm755 "$srcdir"/coredns.initd "$pkgdir"/etc/init.d/coredns
	install -Dm755 "$builddir"/coredns "$pkgdir"/usr/bin/coredns
	install -d "$pkgdir"/etc/coredns
}

sha512sums="e145dbbcca80b8bd2138a2bc06f82ca948e00b3a2a2bd7831ee75dcc8eee6da1d71b2aa2cc47372509f8e89aa56e01d7a91fa393fa617970a029fca73188b004  coredns-1.7.0.tar.gz
2ff396033c570f45b5880556a8724b05356276db451cf6e6cfb477f64f4b863801a891940f72c0b1c8268bae176094d02890d27146901f296e4e8d9b703934d2  coredns.confd
62b6d9c8c980990bec896b2d6e0e626b0ea4a7db80ac925772e0d6f2793a6a511165bbd76b52f38a2e8243ffc68e430b32cf33c32332b483fc528ed57e2b2927  coredns.initd"
